package edu.nf.ch03.service;

import edu.nf.ch03.tool.AppTools;
import lombok.RequiredArgsConstructor;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.stereotype.Service;

/**
 * @author wangl
 * @date 2025/4/19
 */
@Service
@RequiredArgsConstructor
public class ToolChatService {

    private final ChatModel chatModel;

    private final AppTools tools;

    public String chat(String prompt) {
        return ChatClient.create(chatModel)
                .prompt()
                .system("当有工具调用后，只需要做出简要的回答即可")
                .user(prompt)
                .tools(tools)
                .call()
                .content();
    }
}